<template>
  <div class="user">
    <SimpleHeader title="我的"></SimpleHeader>
    <FixedPad></FixedPad>
    <div class="user-card">
      <div class="user-icon">
        <i class="iconfont bee-big-user"></i>
      </div>
      <div class="user-detail">
        <div class="nickname">昵称：{{ detail.nickName }}</div>
        <div class="loginName">登录名：{{ detail.loginName }}</div>
        <div class="sign">个性签名：{{ detail.introduceSign }}</div>
      </div>
    </div>
    <div class="user-list">
      <div class="address">
        <span>我的订单</span>
        <i class="iconfont bee-right"></i>
      </div>
      <div class="address">
        <span>地址管理</span>
        <i class="iconfont bee-right"></i>
      </div>
      <div class="abount">
        <span>关于</span>
        <i class="iconfont bee-right"></i>
      </div>
    </div>
  </div>
</template>

<script>
import SimpleHeader from '@/components/SimpleHeader'
import FixedPad from '@/components/FixedPad'
import { getUserInfo } from '@/api/user'
export default {
  name: 'Mine',
  components: {
    SimpleHeader,
    FixedPad,
  },

  data() {
    return {
      detail: {},
    }
  },

  mounted() {
    this.getUserInfoApi()
  },

  methods: {
    async getUserInfoApi() {
      const params = {
        token: localStorage.getItem('token'),
      }
      const res = await getUserInfo(params).catch((err) => {
        console.log(err)
        this.$toast.fail('请求出错')
      })
      if (res && res.resultCode === 200) {
        this.detail = res.data
      }
    },
  },
}
</script>

<style lang="less" scoped>
@import '../../common/style/mixin.less';
.user {
  font-size: 0.32rem;
  .user-card {
    display: flex;
    align-items: center;
    width: 350px;
    background-color: @primary;
    border-radius: 5px;
    margin: 10px auto;
    padding: 16px 10px;
    box-shadow: 0 3px 5px @primary;
    .user-icon {
      padding-left: 10px;
      .bee-big-user {
        color: #fff;
        font-size: 54px;
      }
    }
    .user-detail {
      margin-left: 20px;
      font-size: 14px;
      color: #fff;
      > div {
        line-height: 24px;
      }
    }
  }
  .user-list {
    padding: 0 20px;
    margin-top: 20px;
    font-size: 14px;
    > div {
      display: flex;
      justify-content: space-between;
      align-items: center;
      color: #2c3e50;
      height: 40px;
      line-height: 40px;
      border-bottom: 1px solid #e9e9e9;
      .bee-right {
        color: #2c3e50;
        font-size: 14px;
      }
    }
  }
}
</style>
